package v1

import (
	"SmartLibrary/internal/model"
	"time"
)

type RegisterRequest struct {
	UserName string `json:"userName" binding:"required" example:"alan"`
	Password string `json:"password" binding:"required" example:"123456"`
}

type LoginRequest struct {
	UserName string `json:"userName" binding:"required" example:"alan"`
	Password string `json:"password" binding:"required" example:"123456"`
}
type LoginResponseData struct {
	AccessToken string `json:"accessToken"`
}
type LoginResponse struct {
	Response
	Data LoginResponseData
}

type UpdateProfileRequest struct {
	UserName string `json:"userName" example:"alan"`
}
type GetProfileResponseData struct {
	UserId     int64  `json:"userId"`
	UserName   string `json:"userName" example:"alan"`
	CardName   string `json:"cardName" example:"testName"`
	CardNumber int64  `json:"cardNumber" example:"12345678901"`
	RuleNumber int32  `json:"ruleNumber" example:"10"`
	Status     int32  `json:"status" example:"1"`
}
type GetProfileResponse struct {
	Response
	Data GetProfileResponseData
}

var BookValidAttributes = map[string]string{
	"book_number":      "",
	"book_name":        "",
	"book_author":      "",
	"book_location":    "",
	"book_description": "",
}
var BorrowValidAttributes = map[string]string{
	"book_number": "",
	"borrow_date": "",
	"close_date":  "",
	"return_date": "",
}
var ViolationValidAttributes = map[string]string{
	"book_number":       "",
	"borrow_date":       "",
	"close_date":        "",
	"return_date":       "",
	"violation_message": "",
}

type GetBooksCondition struct {
	Offset    int
	Limit     int
	Condition string
	Query     string
}
type GetBooksResponse struct {
	Records *[]model.UserBook `json:"records"`
	Total   int64             `json:"total"`
}

type GetBorAndVioCondition struct {
	UserId     int64
	CardNumber int64
	Offset     int
	Limit      int
	Condition  string
	Query      string
}
type GetBorrowsResponse struct {
	Records *[]model.UserBorrow `json:"records"`
	Total   int64               `json:"total"`
}

type GetRulesResponse struct {
	Records *[]model.UserRule `json:"records"`
	Total   int               `json:"total"`
}

type GetViolationsResponse struct {
	Records *[]model.UserViolation `json:"records"`
	Total   int64                  `json:"total"`
}

type CreateCommentRequest struct {
	CommentMessage string `json:"commentMessage" binding:"required" example:"test"`
	UserId         int64
	CreateTime     time.Time
}

type ChatParams struct {
	UserID    int64  `json:"userId" binding:"-"`
	Message   string `json:"message" binding:"required"`
	Assistant string `json:"assistant" binding:"omitempty"`
}
type ChatConditions struct {
	Role    string `json:"role"`
	Content string `json:"content"`
}
